package Lab08;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

//8_3
public class MathUtil {


    public static Integer min(ArrayList<Integer> list) {
        if (list == null || list.size() == 0) return null;
        Integer minNum = list.get(0);
        for (int i = 1; i < list.size(); i++) {
            if (minNum > list.get(i)) {
                minNum = list.get(i);
            }
        }
        return minNum;
    }
}

class MainMathUtil {
    public static void main(String[] args) throws FileNotFoundException {
        for(int i=3;i<=5;i++){
//            readFromFile(i);
        }

    }

    void readFromConsole() {
        System.out.print("Enter integers(input ends with 0):");
        Scanner scanner = new Scanner(System.in);
        ArrayList<Integer> list = new ArrayList<>();
        while (scanner.hasNextInt()) {
            int intNum = scanner.nextInt();
            if (intNum == 0) break;
            list.add(intNum);

        }
        scanner.close();
        System.out.println("The mininum number is " + MathUtil.min(list));
    }


}